# albumpresenter.py
# note: this should contain no application logic betweens delegating UI events to controllers
#     in case that the UI event is trivial (no validation, etc), presenter is allowed to call
#     the controller API directly
import wx
from pysage import Actor, ActorManager

omanager = ActorManager.get_singleton()

class AlbumPresenter(Actor):
    '''this acts between controllers and the viewers, for delegating events'''
    def on_album_select(self, evt):
        return omanager.find('albumcontroller').view_album(evt.GetSelection())
    def right_mouse_up(self, evt):
        height = 0
        albumviewer = omanager.find('albumviewer')
        for i in range(albumviewer.GetItemCount()):
            item_height = albumviewer.OnMeasureItem(i)
            if evt.Y > height and evt.Y < height + item_height:
                return omanager.find('albumcontroller').right_mouse_up(i)
            height += item_height
        return True
        
        
        
        
        